import java.util.Scanner;
/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86186
 * Date: 2023-09-24
 * Time: 14:05
 */
public class Demo2 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        int n = in.nextInt();
        if(n == 1) {
            System.out.println(1);
            return;
        }
        long[] arr = new long[n];
        for (int i = 0; i < n; i++) {
            arr[i] = in.nextLong();
        }
        int count = 1;
        int flg1 = 1;
        boolean flg2 = true;
        int i = 0;
        while(i < n-1) {
            long sub = arr[i + 1] - arr[i];
            if (flg2) {
                while(i < n - 1 && arr[i + 1] - arr[i] == 0) {
                    i++;
                }
                flg1 = arr[i + 1] - arr[i] > 0 ? 1 : -1;
                flg2 = false;
            }
            if(sub * flg1 < 0) {
                count++;
                flg2 = true;
            }
            i++;
        }
        System.out.println(count);
    }
}
